﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="baseUrl" value="${pageContext.request.contextPath }"></c:set>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>更新用户</title>
<script type="text/javascript" src="${baseUrl }/js/jquery-3.3.1.js"></script>
<link type="text/css" rel="stylesheet" href="${baseUrl }/css/style.css" >
<script type="text/javascript">
	$(function(){
		var common = ${user.common}
		var supers = ${user.supers}
		var sex = ${user.sex}
		alert(supers)
		$("#common option").each(function(){
			if($(this).val()==common){
				$(this).attr("selected",true)
			}
		})
		$("#supers option").each(function(){
			if($(this).val()==supers){
				$(this).attr("selected",true)
			}
		})
		$("#select option").each(function(){
			if($(this).val()==sex){
				$(this).attr("selected",true)
			}
		})
	})
</script>
</head>
<body>
	<div class="main">
		<div class="optitle clearfix">
			<div class="title">用户管理&gt;&gt;</div>

		</div>
		<form id="form1" name="form1" method="post" action="${baseUrl }/UserController/updateUser">
			<div class="content">
				<table class="box">
					<tr>
						<td class="field">用户编号：</td>
						<td><input type="text" name="id" id="id" class="text" value="${user.id}" readonly="readonly" />
						</td>

					</tr>
					<tr>
						<td class="field">用户名称：</td>
						<td><input type="text" name="userName" class="text"
							id="userName" value="${user.userName}" /> <font color="red">*</font></td>
					</tr>
					<tr>
						<td class="field">新密码：</td>

						<td><input type="password" name="password" class="text"
							id="password" value="${user.password}" /> <font color="red">*</font></td>
					</tr>
					<tr>
						<td class="field">确认密码：</td>
						<td><input type="password" name="password2" id="password2" class="text" 
						oninput="valide()" value="${user.password}" /> <font
							color="red"><span id="s">*</span></font></td>
					</tr>

					<tr>
						<td class="field">用户性别：</td>
						<td><select name="sex" id="select">
								<option value="">请选择</option>
								<option value="0">女</option>
								<option value="1">男</option>
						</select></td>
					</tr>

					<tr>
						<td class="field">用户年龄：</td>
						<td><input type="text" name="age" class="text"
							id="textfield2" value="${user.age}" /> <font color="red">*</font></td>
					</tr>
					<tr>
						<td class="field">用户电话：</td>
						<td><input type="text" name="mobile" class="text"
							id="mobile" value="${user.mobile}" /> <font color="red">*</font></td>

					</tr>
					<tr>
						<td class="field">用户地址：</td>
						<td><textarea name="address" id="address" class="text"
								cols="45" rows="5">${user.address}</textarea></td>
					</tr>
					<tr>
						<td class="field">是否是普通员工：</td>
						<td><select name="common" id="common">
								<option value="">请选择</option>
								<option value="0">不是</option>
								<option value="1">是</option>
						</select></td>
					</tr>
					<tr>
						<td class="field">是否是经理：</td>
						<td><select name="supers" id="supers">
								<option value="">请选择</option>
								<option value="0">不是</option>
								<option value="1">是</option>
						</select></td>
					</tr>
				</table>
			</div>
			<div class="buttons">
				<input type="submit" name="button" id="button" value="数据提交"
					class="input-button" /> <input type="button" name="button"
					id="button" onclick="window.history.go(-1)" value="返回"
					class="input-button" />
			</div>

		</form>
	</div>
</body>
</html>
